const test = {
	state: {
		list: [
			{ id: 1, title: 'fuck lily', bool: true },
			{ id: 2, title: 'hello world', bool: true },
			{ id: 3, title: 'My name is van', bool: true },
			{ id: 4, title: 'data format', bool: true },
			{ id: 5, title: 'cao ni da ye', bool: false }
		]
	},
	getters: {
		getList: state => {
			return state.list.filter(one => one.bool)
		},
		getInfoById: state => id => {
			return state.list.find(one => one.id === id)
		}
	},
	mutations: {
		modifyList (state) {
			state.list.push({ id: 6, title: 'new title', bool: true })
		},
		testModify (state, data) {
			let info = state.list.find(one => one.id === data.id)
			info.title = data.title
		},
		updateList (state, data) {
			state.list.push(data)
		}
	},
	actions: {
		increment ({commit}) {
			commit('modifyList')
		},
		incrementObj ({commit}, obj) {
			setTimeout(() => {
				console.info('inside test add object')
				commit('updateList', obj)
			}, 2000)
		}
	}
}

export default test
